package com.zzy.ecommerce.service.impl;

import com.zzy.ecommerce.dao.TAccountMapper;
import com.zzy.ecommerce.domain.TAccount;
import com.zzy.ecommerce.domain.TUser;
import com.zzy.ecommerce.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Transactional
@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private TAccountMapper tAccountMapper;

    @Override
    public List<TAccount> selectAllAccount() {
        return tAccountMapper.selectAllAccount();
    }

    @Override
    public Integer deleteOneAccount(Integer userId) {
        return tAccountMapper.deleteOneAccount(userId);
    }

    @Override
    public Integer deleteAllAccounts() {
        return tAccountMapper.deleteAllAccounts();
    }

    @Override
    public Integer insertOneAccount(TAccount account) {
        return tAccountMapper.insertOneAccount(account);
    }

    @Override
    public Integer insertOneAccountByUser(TUser user) {
        return tAccountMapper.insertOneAccountByUser(user);
    }

    @Override
    public TAccount selectOneAccount(Integer id) {
        return tAccountMapper.selectOneAccount(id);
    }
}
